<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h3>学生分数列表</h3>
	<h4>欢迎${sessionScope.USER_IN_SESSION.name}老师,请选择以下操作:</h4>

	<!-- 退出系统的表单 -->
	<form action="/s/exit" method="post">
		<input type="submit" name="exit" value="退出系统">
	</form>

	<!-- 返回欢迎页面的表单 -->
	<form action="/s/scores/welcome" method="post">
		<input type="submit" name="exit" value="返回欢迎页面"><br>
	</form>
	
	<a href="#">新增成绩</a>+

	<!-- 显示表格的表单 -->
	<form action="/s/scores/listByPage" method="post" id="showTable">
		<tr>
			<td>
				<a href="/s/scores/listByPage?currentPage=1">首页</a> 
				<a href="/s/scores/listByPage?currentPage=${pageResult.prePage}">上一页</a>
				
				<c:forEach begin="${pageResult.beginIndex}" end="${pageResult.endIndex}" var="index">
				<a href="/s/scores/listByPage?currentPage=${index}">${index}</a>
				</c:forEach>
				
				<a href="/s/scores/listByPage?currentPage=${pageResult.nextPage}">下一页</a>
				<a href="/s/scores/listByPage?currentPage=${pageResult.totalPage}">尾页</a>
				总条数:${pageResult.totalCount}
				当前页/总页数:${pageResult.currentPage}/${pageResult.totalPage} 
				<!-- 跳转至某一页 -->
				<input type="number" name="currentPage" style="width: 50px;" min="1"
				value="${pageResult.currentPage}" max="${pageResult.totalPage}"> 
				<input type="submit" value="跳转"> 
				<!-- 设置一页显示多少条 --> 每一页显示
				<select name="pageSize" onchange="document.getElementById('showTable').submit()">
					<option ${pageResult.pageSize==10?'selected=selected':''}>10</option>
					<option ${pageResult.pageSize==20?'selected=selected':''}>20</option>
					<option ${pageResult.pageSize==30?'selected=selected':''}>30</option>
			</select>条
			</td>
		</tr>

		<table cellpadding="5" cellspacing="1" width="600pixels" border="2">
			<tr style="background-color: olive;">
				<th>id</th>
				<th>姓名</th>
				<th>班级</th>
				<th>语文</th>
				<th>数学</th>
				<th>英语</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${pageResult.listData}" var="score" varStatus="vs">
				<tr style="background-color: ${vs.count%2==0?'Lavender':''};">
					<td align="center">${pageScope.score.id}</td>
					<td align="center">${pageScope.score.name}</td>
					<td align="center">${pageScope.score.classId}</td>
					<td align="center">${pageScope.score.chineseScore}</td>
					<td align="center">${pageScope.score.mathScore}</td>
					<td align="center">${pageScope.score.englishScore}</td>
					<td align="center"><a href="#">编辑</a>|<a href="#">删除</a></td>
				</tr>
			</c:forEach>
		</table>

	</form>
</body>
</html>